# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=libglvnd
pkgver=1.6.0
pkgrel=1
pkgdesc="The GL Vendor-Neutral Dispatch library"
arch=('x86_64')
url="https://gitlab.freedesktop.org/glvnd/libglvnd"
license=('custom:BSD-like')
makedepends=('libxext' 'libx11' 'xorgproto' 'python' 'meson')
provides=('libgl' 'libegl' 'libgles')
provides+=(libEGL.so libGL.so libGLESv2.so libGLX.so libGLdispatch.so libOpenGL.so)
source=("https://gitlab.freedesktop.org/glvnd/libglvnd/-/archive/v$pkgver/libglvnd-v$pkgver.tar.gz"
        LICENSE)
sha512sums=('8b8be80d94da7d9ffe58dccbcd5bd8079e86326a3a1a880ff1f7bf6f2d74eb5143cd3783fc2d8119fed597b3376e33f34ed889cc2259073dfd1d6c985a739df6'
            'bf0f4a7e04220a407400f89226ecc1f798cc43035f2538cc8860e5088e1f84140baf0d4b0b28f66e4b802d4d6925769a1297c24e1ba39c1c093902b2931781a5')

build() {
  arch-meson $pkgname-v$pkgver build \
    -D gles1=false

  meson compile -C build
}

package() {
  # libglvnd needs mesa for indirect rendering
  depends=('libxext' 'mesa' 'opengl-driver')

  meson install -C build --destdir "$pkgdir"

  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
